package cn.innosmart.aq.customize.fontcheckbox;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import cn.innosmart.aq.R;

/**
 * Created by David on 2016/1/4.
 */
public class FontCheckBox extends LinearLayout {
    private boolean isCheck;
    private TextView leftButton;
    private TextView rightButton;
    private Context mContext;

    public FontCheckBox(Context context) {
        this(context, null, 0);
    }

    public FontCheckBox(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public FontCheckBox(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.mContext = context;
        LayoutInflater.from(context).inflate(R.layout.font_button, this, true);
        initView(context);
    }

    private void initView(Context context) {
        leftButton = (TextView) findViewById(R.id.left_button);
        rightButton = (TextView) findViewById(R.id.right_button);
//        rightButton.setTextColor(context.getResources().getColor(R.color.font_lightblue));
    }

    public boolean isCheck() {
        return isCheck;
    }

    /**
     * 左侧打开
     */
    public void setLeftOpen() {
        leftButton.setTextColor(mContext.getResources().getColor(R.color.font_lightblue));
        rightButton.setTextColor(mContext.getResources().getColor(R.color.font_lightwhite));
    }

    /**
     * 右侧打开
     */
    public void setRightOpen() {
        rightButton.setTextColor(mContext.getResources().getColor(R.color.font_lightblue));
        leftButton.setTextColor(mContext.getResources().getColor(R.color.font_lightwhite));
    }

}
